use std::cmp::Reverse;
use std::collections::BinaryHeap;
impl Solution {
    pub fn maximum_product(nums: Vec<i32>, k: i32) -> i32 {
        let mut heap=BinaryHeap::with_capacity(nums.len());
        for i in nums{
            heap.push(Reverse(i));
        }
        for i in 0..k{
            if let Some(Reverse( mut t))=heap.pop(){
                t+=1;
                heap.push(Reverse(t))
            }
        };
        let mut ans =1 as i64;
        for Reverse(i) in heap.iter(){
            ans=(ans*(*i as i64))%(1000_000_000+7);
        }
        ans as i32
    }
}